#ifndef CIPHHERMANAGER_H
#define CIPHHERMANAGER_H
#include <filesystem>
#include "cipher.h"

namespace crypto {
class cipherManager
{
public:
	cipherManager(utils::CipherAlgorithm algorithm, Botan::SymmetricKey key, const std::filesystem::path &fileNameIV);

	cipherManager(utils::CipherAlgorithm algorithm, Botan::SymmetricKey key, const Botan::secure_vector<uint8_t>& iv);

	~cipherManager();

	void setPath(const std::filesystem::path &fileNameIV);

	void setPath(const Botan::secure_vector<uint8_t>& fileNameIV);

	Botan::secure_vector<uint8_t> encrypt(const Botan::secure_vector<uint8_t> &plaintext, bool saveIV);

	Botan::secure_vector<uint8_t> decrypt(const Botan::secure_vector<uint8_t> &plaintext, bool loadIV);

	Botan::secure_vector<uint8_t> updateDecryption(const Botan::InitializationVector& newIV, const Botan::secure_vector<uint8_t> &plaintext);

	std::shared_ptr<Cipher> getCipher();

	Botan::InitializationVector generateIV();
private:
	std::shared_ptr<Cipher> cipher;
	Botan::SymmetricKey key;
	utils::CipherAlgorithm algos;
	Botan::secure_vector<uint8_t> path;
};
}

#endif // CIPHHERMANAGER_H
